import matplotlib.pyplot as plt
from skimage.data import camera,coffee
from skimage.filters import laplace
from skimage import io,color
"""
中文显示工具函数
"""
def set_ch():
    from pylab import mpl
    mpl.rcParams['font.sans-serif']=['FangSong']
    mpl.rcParams['axes.unicode_minus']=False
set_ch()

# image = camera()
image = io.imread('lena.bmp') 
image=color.rgb2gray(image)
edge_laplace = laplace(image)
image1=coffee()
edge_laplace1=laplace(image1)

fig, ax = plt.subplots(ncols=2,nrows=2,sharex=True, sharey=True,
                    figsize=(8, 6))
ax[0,0].imshow(image, cmap=plt.cm.gray)
ax[0,0].set_title('原始图像')

ax[0,1].imshow(edge_laplace, cmap=plt.cm.gray)
ax[0,1].set_title('Laplace 边缘检测')

ax[1,0].imshow(image1)
ax[1,0].set_title('原始图像')

ax[1,1].imshow(edge_laplace1)
ax[1,1].set_title('Laplace 边缘检测')

for a in ax:
    for j in a:
        j.axis('off')

plt.tight_layout()
plt.show()
